package com.dkts.oil.router.param;

import com.alibaba.fastjson.JSONArray;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Schema(description = "路径信息")
@Data
public class PathInfo {

    @Schema(description = "距离 单位米")
    private Double distance;
    @Schema(description = "时间 单位秒")
    private Long time;

    @Schema(description = "路径点信息")
    private RoutePoints points;

    @Schema(description = "路径点信息")
    private List<RoutePoints> roadInfos;

    @Schema(description = "路径说明信息")
    private List<Instructions> instructions;

    @Schema(description = "筹措信息")
    List<RoadSegmentSummary> fundInfo;

    @Schema(description = "创建新的公路对象，起点到规划点道路上 距离超过5公里有规划")
    private CreateRoadSegments startNewRoad;

    @Schema(description = "创建新的公路对象，终点到规划点道路上 距离超过5公里有规划")
    private CreateRoadSegments endNewRoad;

    @Schema(description = "路径点信息")
    @Data
    public static class RoutePoints {
        @Schema(description = "类型：LingString")
        private String type;
        @Schema(description = "道路类型：1 先建公路，0: 原有公路 ")
        private int roadType;
        @Schema(description = "经纬度信息")
        private JSONArray coordinates;

        public RoutePoints() {
            this.type = "LineString";
            this.roadType = 0;
        }

        public RoutePoints(JSONArray coordinates) {
            this.type = "LineString";
            this.roadType = 0;
            this.coordinates = coordinates;
        }
    }

    @Data
    @Schema(description = "路径说明信息")
    public static class Instructions {

        @Schema(description = "该路段距离 单位米")
        private Double distance;
        @Schema(description = "该路段耗时 单位秒")
        private Long time;

        @Schema(description = "该路段描述")
        private String text;

        @Schema(description = "该路段指令： sign值\t含义\t说明\n" +
                "0\t直行（继续前进）\t保持当前路线，继续行驶\n" +
                "1\t轻微右转\t稍向右偏转\n" +
                "2\t右转\t明显右转\n" +
                "3\t急右转\t急剧右转\n" +
                "-1\t轻微左转\t稍向左偏转\n" +
                "-2\t左转\t明显左转\n" +
                "-3\t急左转\t急剧左转\n" +
                "4\t到达目的地\t导航结束\n" +
                "5\t到达途经点\t经过一个途经点\n" +
                "6\t保持右侧\t进入环岛或高速匝道，保持右侧\n" +
                "-6\t保持左侧\t进入环岛或高速匝道，保持左侧")
        private Integer sign;

        @Schema(description = " 通常表示该导航指令所对应的路径点索引区间, RoutePoints  里的 coordinates 索引区间")
        private JSONArray interval;

        @Schema(description = "街道的名称")
        private String streetName;
    }

    @Schema(description = "筹措信息")
    @Data
    public static class RoadSegmentSummary {
        @Schema(description = "路段code： A1 A2")
        private String code;        // A1 A2 ...
        @Schema(description = "路段名称")
        private String roadName;    // 起点 → 终点
        @Schema(description = "路段里程：单位千米")
        private double distanceKm;
        @Schema(description = "路段耗时：单位分钟")
        private int durationMin;

        @Schema(description = "路段操作")
        private List<String> actions;
    }

    @Data
    @Schema(description = "创建新的公路对象，当规划点到起点，或 终点到前一个点的距离大于5公里时需要去创建公路")
    public static class CreateRoadSegments {

        @Schema(description = "距离 单位米")
        private Double distance;

        @Schema(description = "是否创建新的公路对象,true 是")
        private Boolean isNewRoad;

//        @Schema(description = "创建新的公路对象，起点到规划点道路上 距离超过5公里有规划")
//        private String name="新公路";

        public CreateRoadSegments(Double distance,Boolean isNewRoad) {
            this.distance = distance;
            this.isNewRoad = isNewRoad;
        }
        public CreateRoadSegments() {
            this.distance = 0.0;
            this.isNewRoad = false;
        }
    }


}
